Hello,

There's something I'm having trouble understanding with the Keyword Analyzer.

I'm indexing elements with a field named /type/, in which I put the value /hello world/, using the INDEX_TOKENIZED flag. With a WhitespaceAnalyzer, the field becomes split into 2 terms in the index :/type=hello/ and /type=world/. Fine. With a KeywordAnalyzer, there's only 1 term, /type=hello world/. Perfect.

But my problem is when I build my search queries, using the QueryParser :

QueryParser lParser( _T( "type" ), lAnalyzer );
Query* lQuery = lParser.parse( _T( "hello world*" ) );

(That * at the end is important for reasons I don't need to explain here)
This results in my search query being (type:hello type:world*), no matter which analyzer I use (Whitespace or Keyword). I'm guessing this is normal, because the Lucene Syntax rules take whitespaces as separators between different terms. The analyzer doesn't have any influence on that (correct me if I'm wrong).

To prevent that, I should put /hello world/ between " ", so the whitespace isn't taken into account. But if I do that, where can I put my * at the end ?
If I give the parser/"hello world*"/, the * isn't processed as a wildcard.
If I give the parser /"hello world"*/, the query becomes (type:hello world type:*), which isn't ok.

Any help ? I'm probably missing something.

As a side question, what's the influence of an Analyzer in the QueryParser ?

Thanks !





------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
CLucene-developers mailing list
CLucene-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/clucene-developers

Reply via email to