lucenenet-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Svensson <si...@devhost.se>
Subject Re: Lucene query parser multiple words
Date Wed, 08 May 2013 16:46:01 GMT
Hi,

This does not match the behavior of QueryParser.

var analyzer = new StandardAnalyzer(Version.LUCENE_30);
var parser = new QueryParser(Version.LUCENE_30, "f", analyzer);
var query = parser.Parse("word1 word2 word3 word4");

Should return a query matching "f:word1 f:word2 f:word3 f:word4", i.e. 
optional match (can be changed with parser.DefaultOperator = ...)

It sounds like you're using some odd analyzer which produces odd tokens. 
Could you provide us with a small test case to reproduce your behavior?

// Simon

On 2013-05-08 18:34, Omri Suissa wrote:
> When using lucene QueryParser to parse a query with multipal words i found
> that the returned query is like the following:
>
> *query text:*
>
> word1 word2 word3 word4
>
> *returned query:*
>
> content:word1 content:"word1 word2" content:"word1 word2 word3"
> content:"word1 word2 word3 word4"
>
> The logic, as i understand it is: first word, first + second word, first +
> second + third word and etc...
>
> This logic sound too simple for my needs. for example if the user search
> the following query:
>
> myDoc.txt anotherDoc.txt
>
> the user except to get results with myDoc.txt or with anotherDoc.txt (or
> both).
>
> but... since the logic that described the user will get only results for
> "myDoc.txt" and "myDoc.txt and anotherDoc.txt" and not about anotherDoc.txt
> (second word alone).
>
> *My code:*
>
> new QueryParser(Lucene.Net.Util.Version.LUCENE_30, "content",
> analyzer).Parse(strQuery);
>
> to "see" the query i'm using the ToString() method on the query object.
>
> There is a way to change this behavior? (or am i missing something here?)
>
>
> Thanks,
>
> Omri
>


Mime
View raw message