lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asmcad <asm...@gmail.com>
Subject hey everybody - multiple words searching
Date Mon, 22 Nov 2010 02:29:25 GMT
i want to perform multiple word search with wildquery. is it possiple ?

if i search something like "*ometh*" i get result which contains  like 
"... something ..". thats ok.
but if i search something like "green house" i can't get any result. i 
hope i'm clear enough.

here some of my code:

if (textBoxQuery.Text != "")
             {
                 BooleanQuery.SetMaxClauseCount(10000);
                 listViewResults.Items.Clear();
                 IndexSearcher indxsearcher = new 
IndexSearcher(@"C:\index\");

                 //QueryParser parser = new QueryParser("text", new 
SimpleAnalyzer());
                 //Query query = parser.Parse(textBoxQuery.Text);

                 Term term = new Term("text", textBoxQuery.Text);
                 Query query = new WildcardQuery(term);



                 Hits hits = indxsearcher.Search(query);


                 for (int i = 0; i < hits.Length(); i++)
                 {

                     Document doc = hits.Doc(i);


                     string filename = doc.Get("title");
                     string path = doc.Get("path");
                     string folder = Path.GetDirectoryName(path);


                     ListViewItem item = new ListViewItem(new string[] { 
null, filename, path , hits.Score(i).ToString() });
                     item.Tag = path;
                     item.ImageIndex = 
imageListDocuments.IconIndex(filename);
                     this.listViewResults.Items.Add(item);
                     Application.DoEvents();
                 }

                 indxsearcher.Close();

             }

i googled it and found some guys says i need to use "QueryParser " but i 
couldn implement with wildquery. if somebody can help i'd be glad.

thanks.


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message