[Koha-cvs] CVS: koha/C4 Biblio.pm,1.112,1.113 SearchMarc.pm,1.34,1.35

Paul POULAIN tipaul at users.sourceforge.net
Fri Dec 10 17:27:56 CET 2004


Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12413/C4

Modified Files:
	Biblio.pm SearchMarc.pm 
Log Message:
limiting the number of search term to 8. There was no limit before, but 8 words seems to be the upper limit mySQL can deal with (in less than a second. tested on a DB with 13 000 items)
In 2.4, a new DB structure will highly speed things and this limit will be removed.
FindDuplicate is activated again, the perf problems were due to this problem.


Index: Biblio.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Biblio.pm,v
retrieving revision 1.112
retrieving revision 1.113
diff -C2 -r1.112 -r1.113
*** Biblio.pm	8 Dec 2004 10:14:42 -0000	1.112
--- Biblio.pm	10 Dec 2004 16:27:53 -0000	1.113
***************
*** 293,303 ****
      my ( $dbh, $kohafield,$frameworkcode ) = @_;
      return 0, 0 unless $kohafield;
!     my $sth =
!       $dbh->prepare(
! "select tagfield,tagsubfield from marc_subfield_structure where frameworkcode=? and kohafield=?"
!     );
!     $sth->execute($frameworkcode,$kohafield);
!     my ( $tagfield, $tagsubfield ) = $sth->fetchrow;
!     return ( $tagfield, $tagsubfield );
  }
  
--- 293,305 ----
      my ( $dbh, $kohafield,$frameworkcode ) = @_;
      return 0, 0 unless $kohafield;
! 	my $relations = C4::Context->marcfromkohafield;
! 	return ($relations->{$frameworkcode}->{$kohafield}->[0],$relations->{$frameworkcode}->{$kohafield}->[1]);
! #     my $sth =
! #       $dbh->prepare(
! # "select tagfield,tagsubfield from marc_subfield_structure where frameworkcode=? and kohafield=?"
! #     );
! #     $sth->execute($frameworkcode,$kohafield);
! #     my ( $tagfield, $tagsubfield ) = $sth->fetchrow;
! #     return ( $tagfield, $tagsubfield );
  }
  
***************
*** 2526,2531 ****
  	my ($record)=@_;
  	my $dbh = C4::Context->dbh;
- 	# FIXME  re-activate FindDuplicate
- 	return;
  	my $result = MARCmarc2koha($dbh,$record,'');
  	# search duplicate on ISBN, easy and fast...
--- 2528,2531 ----
***************
*** 2633,2636 ****
--- 2633,2641 ----
  # $Id$
  # $Log$
+ # Revision 1.113  2004/12/10 16:27:53  tipaul
+ # limiting the number of search term to 8. There was no limit before, but 8 words seems to be the upper limit mySQL can deal with (in less than a second. tested on a DB with 13 000 items)
+ # In 2.4, a new DB structure will highly speed things and this limit will be removed.
+ # FindDuplicate is activated again, the perf problems were due to this problem.
+ #
  # Revision 1.112  2004/12/08 10:14:42  tipaul
  # * desactivate FindDuplicate

Index: SearchMarc.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/SearchMarc.pm,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** SearchMarc.pm	8 Dec 2004 10:21:46 -0000	1.34
--- SearchMarc.pm	10 Dec 2004 16:27:53 -0000	1.35
***************
*** 401,405 ****
  	my $nb_table=1; # will contain the number of table. ++ on each entry EXCEPT when an OR  is provided.
  
! 	for(my $i=0; $i<=@$value;$i++) {
  		if (@$value[$i]) {
  			$nb_active++;
--- 401,408 ----
  	my $nb_table=1; # will contain the number of table. ++ on each entry EXCEPT when an OR  is provided.
  
! 	my $maxloop=8; # the maximum number of words to avoid a too complex search.
! 	$maxloop = @$value if @$value<$maxloop;
! 	
! 	for(my $i=0; $i<=$maxloop;$i++) {
  		if (@$value[$i]) {
  			$nb_active++;





More information about the Koha-cvs mailing list