The crash happens if you instead add these two fields:

            doc.add(new TextField("ExampleText", "periodic function", Field.Store.NO));             doc.add(new TextField("ExampleText", "plot of the original function", Field.Store.NO));

I'm attaching an updated file as well this this changes.

This happens in Lucene 8.8.0 (and probably since 8.4.0).

Thanks!

El 10/2/21 a las 19:11, Nicolás Lichtmaier escribió:
This happens on Lucene 8.8. I deleted the index and now I don't see the problem. =( I'll post an updated version of the code shortly.

Thanks!

El 10/2/21 a las 19:01, Chris Hostetter escribió:
: I've been able to reproduce a crash we are seeing in our product with newer
: Lucene versions.

Can you be specific?  What exact versions of Lucene are you using that
reproduces this failure?  If you know of other "older" versions where you
can't reproduce the problem, that info would also be helpful...


I tried running your test code against the current branch_8x and was
unable to trigger any sort of failure.  I also tried using 8.4.1 based on
the stack trace indicating that you must be using a version of lucene no
older then 8.4 given the codec in use -- and was also unable to reproduce
any sort of problem.

Also note that as written your LuceneCrash code leaves an index on disk
which is re-used the next time the code is run: does the problem reproduce
for you if you manually "rm -r /tmp/xxx" and run it again, or is the
problem specific to having some "cruft" documents left in the index from
previous runs?  Can you zip up the contents of /tmp/xxx on your machine
and attache it ti a new jira?


: Interestingly, the bug does not happen if the index is created on a
: ByteBuffersDirectory.

That makes it seem like the bug might be filesystem specific -- what impl
does the FSDirectory.open() call in your code return?



-Hoss
http://www.lucidworks.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

package com.wolfram.textsearch;

import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.Term;
import org.apache.lucene.queries.function.FunctionScoreQuery;
import org.apache.lucene.search.*;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;

import java.io.IOException;
import java.nio.file.Paths;

public class LuceneCrash
{
	public static void main(String[] args)
	{
		Directory dir;
		try
		{
			Runtime.getRuntime().exec("rm -rf /tmp/xxx");
			dir = FSDirectory.open(Paths.get("/tmp/xxx"));
			IndexWriter indexWriter = new IndexWriter(dir, new IndexWriterConfig());
			Document doc = new Document();
			doc.add(new TextField("ExampleText", "periodic function", Field.Store.NO));
			doc.add(new TextField("ExampleText", "plot of the original function", Field.Store.NO));
			indexWriter.addDocument(doc);
			indexWriter.commit();
			indexWriter.close();
		} catch (IOException e)
		{
			e.printStackTrace();
			return;
		}

		try (DirectoryReader reader = DirectoryReader.open(dir))
		{
			Query q;

			BooleanQuery.Builder bq = new BooleanQuery.Builder();
			bq.add(new TermQuery(new Term("ExampleText", "function")), BooleanClause.Occur.SHOULD);
			bq.add(new TermQuery(new Term("ExampleText", "plot")), BooleanClause.Occur.SHOULD);
			q = bq.build();

			q = FunctionScoreQuery.boostByQuery(q, new PhraseQuery(1, "ExampleText", "function", "plot"), 2);
			q = FunctionScoreQuery.boostByValue(q, DoubleValuesSource.SCORES);

			System.out.println(new IndexSearcher(reader).search(q, 10).totalHits);
		} catch (IOException e)
		{
			e.printStackTrace();
		}
	}
}

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to