From: Ahmed S. <ci7...@gm...> - 2015-02-23 18:31:49
|
<html style="direction: ltr;"> <head> <meta content="text/html; charset=windows-1252" http-equiv="Content-Type"> <style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style> </head> <body style="direction: ltr;" bidimailui-detected-decoding-type="latin-charset" text="#000000" bgcolor="#FFFFFF"> <div class="moz-cite-prefix">Hi, <br> <br> You can't use Exact search query ("" operand) with * or ?<br> <br> One thing you can do to solve is problem is to use a different Analyzer for that field, what it should do is convert whitespaces to _ for example:<br> hello world -> hello_world<br> <br> Yours,<br> <br> Le 23/02/2015 13:55, norbert barichard a écrit :<br> </div> <blockquote cite="mid:54E...@di..." type="cite"> <meta content="text/html; charset=windows-1252" http-equiv="Content-Type"> Hello,<br> <br> There's something I'm having trouble understanding with the Keyword Analyzer. <br> <br> I'm indexing elements with a field named <i>type</i>, in which I put the value <i>hello world</i>, using the INDEX_TOKENIZED flag. With a WhitespaceAnalyzer, the field becomes split into 2 terms in the index :<i> type=hello</i> and <i>type=world</i>. Fine. With a KeywordAnalyzer, there's only 1 term, <i>type=hello world</i>. Perfect. <br> <br> But my problem is when I build my search queries, using the QueryParser :<br> <font face="Courier New, Courier, monospace"><br> QueryParser lParser( _T( "type" ), lAnalyzer );<br> Query* lQuery = lParser.parse( _T( "hello world*" ) );</font><br> <br> (That * at the end is important for reasons I don't need to explain here)<br> 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). <br> <br> To prevent that, I should put <i>hello world</i> between " ", so the whitespace isn't taken into account. But if I do that, where can I put my * at the end ? <br> If I give the parser<i> "hello world*"</i>, the * isn't processed as a wildcard.<br> If I give the parser <i>"hello world"*</i>, the query becomes (type:hello world type:*), which isn't ok.<br> <br> Any help ? I'm probably missing something.<br> <br> As a side question, what's the influence of an Analyzer in the QueryParser ?<br> <br> Thanks !<br> <br> <br> <br> <br> <br> <br> <fieldset class="mimeAttachmentHeader"></fieldset> <br> <pre wrap="">------------------------------------------------------------------------------ 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 <a class="moz-txt-link-freetext" href="http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk">http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk</a></pre> <br> <fieldset class="mimeAttachmentHeader"></fieldset> <br> <pre wrap="">_______________________________________________ CLucene-developers mailing list <a class="moz-txt-link-abbreviated" href="mailto:CLu...@li...">CLu...@li...</a> <a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/clucene-developers">https://lists.sourceforge.net/lists/listinfo/clucene-developers</a> </pre> </blockquote> <br> </body> </html> |