Migrate BooleanQuery Lucene 4.9.0 to Lucene 6.0.3

2016-11-09 Thread Humberto Rocha
Hi, In Lucene 4.9.0 i have: QueryParser parser = new QueryParser("contents",analisador); Query query = parser.parse(parametro); BooleanQuery constrainedQuery = new BooleanQuery(); BooleanQuery inner = new BooleanQuery(); inner.add(ownerQueryX, Occur.SHOULD); inne

Re: Query parser and default operator

2016-11-09 Thread Pawel Rog
Hi Dawid, Thanks for your email. It seems StandardQueryParser is free from this unexpected behavior. I used the code below with Lucene 6.2.1 (org.apache.lucene.queryparser.classic.QueryParser) QueryParser parser = new QueryParser("test", new WhitespaceAnalyzer()); parser.setDefaultOperat

Re: Isn't fieldLength in BM25 supposed to be an integer?

2016-11-09 Thread Ahmet Arslan
Hi Mossaab, Probably due to the encodeNormValue/decodeNormValue transformation of the document length. Please see the aforementioned methods in BM25Similarity.java Ahmet On Wednesday, November 9, 2016 10:25 PM, Mossaab Bagdouri wrote: Hi, On Lucene 6.2.1, I have the following explain ou

Getting list of committed documents

2016-11-09 Thread lukes
Hi all, I need some feedback on getting hold of documents which got committed during commit call on indexwriter. There are multiple threads which keeps on adding documents to indexWriter in parallel, and there's another thread which wakes up after n number of minutes and does the commit. Below a

Isn't fieldLength in BM25 supposed to be an integer?

2016-11-09 Thread Mossaab Bagdouri
Hi, On Lucene 6.2.1, I have the following explain output for a document that contain two words. I'm wondering why the value of fieldLength is not 2. A related question was posted on S.O. two years ago: http://stackoverflow.com/questions/22194920 23.637165 = sum of: 10.065297 = weight(title:goo

Re: Query parser and default operator

2016-11-09 Thread Dawid Weiss
Which Lucene version and which query parser is this? Can you provide a test case/ code sample? I just tried with StandardQueryParser and for: sqp.setDefaultOperator(StandardQueryConfigHandler.Operator.AND); dump(sqp.parse("foo AND bar OR baz", "field_a")); sqp.setDefaultOpe

Re: Query parser and default operator

2016-11-09 Thread Pawel Rog
Hi Eric, Thank you for your email. I understand that Lucene queries are not in boolean logic. My point is only that I would expect identical Lucene queries build from the same input string. My intuition says that default operator should not matter in 2 examples I presented in previous email. -- Pa

Re: Query parser and default operator

2016-11-09 Thread Erick Erickson
Lucene queries aren't boolean logic. You can simulate boolean logic by explicitly parenthesizing, here's an excellent blog on this: https://lucidworks.com/blog/why-not-and-or-and-not/ Best, Erick On Wed, Nov 9, 2016 at 1:37 AM, Pawel Rog wrote: > Hello , > I have a query `foo AND bar OR baz`. W

Query parser and default operator

2016-11-09 Thread Pawel Rog
Hello , I have a query `foo AND bar OR baz`. When I use "AND" as a default operator this is the resulting Lucene query: `+test:foo test:bar test:baz` When I use "OR" this is the resulting query `+test:foo +test:bar test:baz` I expected these two return exactly the same Lucene query because I