Integer.MAX_VALUE sentinel never checked?
Plucene is nearly finished, and is busy being unit-tested to death. In the process of doing this, we found that some of our phrase queries were returning more results than we expected. This is because when PhrasePositions falls off the end of the iterator, it returns a sentinel value: if (!tp.next()) { tp.close(); // close stream doc = Integer.MAX_VALUE;// sentinel value return; } However, I can't see anything else that checks for that sentinel: % grep MAX_ *.java DateFilter.java: String end = DateField.MAX_DATE_STRING(); PhrasePositions.java: doc = Integer.MAX_VALUE; // sentinel value TermScorer.java: doc = Integer.MAX_VALUE;// set to sentinel value TermScorer.java: doc = Integer.MAX_VALUE;// set to sentinel value so a very big document ID is finding its way into the result set. Is this the desired behaviour? -- The elder gods went to Suggoth and all I got was this lousy T-shirt. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Integer.MAX_VALUE sentinel never checked?
I don't think this value actually find its way into the results. Rather it causes PhraseScorer.score() to exit, as this value is always greater than the value of 'end' passed into that method. Doug Simon Cozens wrote: Plucene is nearly finished, and is busy being unit-tested to death. In the process of doing this, we found that some of our phrase queries were returning more results than we expected. This is because when PhrasePositions falls off the end of the iterator, it returns a sentinel value: if (!tp.next()) { tp.close(); // close stream doc = Integer.MAX_VALUE;// sentinel value return; } However, I can't see anything else that checks for that sentinel: % grep MAX_ *.java DateFilter.java: String end = DateField.MAX_DATE_STRING(); PhrasePositions.java: doc = Integer.MAX_VALUE; // sentinel value TermScorer.java: doc = Integer.MAX_VALUE;// set to sentinel value TermScorer.java: doc = Integer.MAX_VALUE;// set to sentinel value so a very big document ID is finding its way into the result set. Is this the desired behaviour? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Integer.MAX_VALUE sentinel never checked?
Doug Cutting: I don't think this value actually find its way into the results. Rather it causes PhraseScorer.score() to exit, as this value is always greater than the value of 'end' passed into that method. Yep, I screwed up; sorry. Working nicely now. -- In related wibbling, I can see an opening for the four lusers of the Apocalypse... I didn't change anything, My e-mail doesn't work, I can't print and Is the network broken?. - Paul Mc Auley - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-lucene-sandbox/contributions/lucli - New directory
ehatcher2003/12/10 18:03:24 jakarta-lucene-sandbox/contributions/lucli - New directory - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-lucene-sandbox/contributions/lucli/META-INF - New directory
ehatcher2003/12/10 18:03:47 jakarta-lucene-sandbox/contributions/lucli/META-INF - New directory - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-lucene-sandbox/contributions/lucli/lib - New directory
ehatcher2003/12/10 18:04:41 jakarta-lucene-sandbox/contributions/lucli/lib - New directory - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-lucene-sandbox/contributions/lucli/src - New directory
ehatcher2003/12/10 18:04:57 jakarta-lucene-sandbox/contributions/lucli/src - New directory - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-lucene-sandbox/contributions/lucli/src/lucli - New directory
ehatcher2003/12/10 18:05:05 jakarta-lucene-sandbox/contributions/lucli/src/lucli - New directory - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-lucene-sandbox/contributions/lucli/src/lucli Completer.java LuceneMethods.java Lucli.java
ehatcher2003/12/10 18:07:45 Added: contributions/lucli README build.xml run.sh contributions/lucli/META-INF MANIFEST.MF contributions/lucli/lib README contributions/lucli/src/lucli Completer.java LuceneMethods.java Lucli.java Log: contribution from Dror Matalon Revision ChangesPath 1.1 jakarta-lucene-sandbox/contributions/lucli/README Index: README === lucli (pronounced Luckily) is the Lucene Command Line Interface. INSTALLATION Edit the run.sh shell script Edit JAVA_HOME to point to your java directory. Edit LUCLI to point to where you installed lucli. Edit LUCLI_MEMORY and set it to the maximum amount of memory you want to allocate to lucli You can also replace the Lucene jar file that came with lucli with your own. ENABLING READLINE If you add the -r command line parameter lucli will try to use a shared library to enable things like tab completion and history. Unfortunately Java doesn't support this capability natively so you'll need a shared library for this. I'm including one that worked for me with Debian Linux. For more details about GNU readline and java see http://java-readline.sourceforge.net/ which is the library that lucli uses. Documentation There is none :-). Type help at the command line or read the code. Enjoy Dror Matalon [EMAIL PROTECTED] 1.1 jakarta-lucene-sandbox/contributions/lucli/build.xml Index: build.xml === project name=lucli default=build basedir=. !-- set global properties for this build -- property name=src value=./src/ property name=build value=./classes/ property name=lucliLib value=${build}/lucli.jar/ !-- Include all elements that Tomcat exposes to applications -- path id=compile.classpath fileset dir=lib include name=*.jar/ /fileset /path target name=init !-- Create the time stamp -- tstamp/ !-- Create the dist directory structure used by compile -- mkdir dir=${build}/ mkdir dir=${build}/docs/ mkdir dir=${build}/docs/javadocs/ /target target name=compile depends=init !-- Compile the java code from ${src} into ${build} -- javac debug=on deprecation=on srcdir=${src} destdir=${build} classpath refid=compile.classpath/ /javac /target target name=build depends=compile jar basedir=${build} includes=**/*.class jarfile=${lucliLib}/ /target /project 1.1 jakarta-lucene-sandbox/contributions/lucli/run.sh Index: run.sh === LUCLI=. LUCLI_MEMORY=128M #JAVA_HOME=/home/dror/j2sdk1.4.1_03/ CLASSPATH=${CLASSPATH}:$LUCLI/lib/libreadline-java.jar:$LUCLI/lib/lucene-1.3-rc3-dev.jar:$LUCLI/classes/lucli.jar PATH=${PATH}:$JAVA_HOME/bin LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$LUCLI export LD_LIBRARY_PATH $JAVA_HOME/bin/java -Xmx${LUCLI_MEMORY} lucli.Lucli #Use this line to enable tab completion. Depends on the Readline shares library #$JAVA_HOME/bin/java lucli.Lucli -r 1.1 jakarta-lucene-sandbox/contributions/lucli/META-INF/MANIFEST.MF Index: MANIFEST.MF === Main-Class: LuceneLine 1.1 jakarta-lucene-sandbox/contributions/lucli/lib/README Index: README === Place libreadline-java.jar and lucene-1.3-rc3-dev.jar here. 1.1 jakarta-lucene-sandbox/contributions/lucli/src/lucli/Completer.java Index: Completer.java === package lucli; /* * The Apache Software License, Version 1.1 * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in *the documentation and/or other materials provided with