You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by Theodoros Vasilopoulos <th...@googlemail.com> on 2007/10/04 11:02:05 UTC

Lucene.NET Search

Hello,

I need to build an advanced search using Lucene.NET. When I say advanced I
actually mean something simple like:

I have 52 documents which are divided into 30 categories and I need to
develop a solution that will do the following.

1. Return all documents(silly but required )
2. Return all documents for a single category.
3. Search in all documents.
and
4. Search in a specific category.

Numbers 1,2,3 are quite easy.

1. I have added a field called "all" which contains the value "all" , so
whenever I need all of the documents I build a Query that searches for the
word "all" in the filed "all".
query = QueryParser.Parse("all", "all", new StandardAnalyzer());
problem solved

2. I have added another field that contains the category that the specific
document belongs to. So, I simply ask for that category like this:
query = QueryParser.Parse("\"" + comboBox1.Text + "\"", "subject", new
StandardAnalyzer());
problem solved

3. Quite simple and straight-forward really. Just a plain full-text search
in the document.
query = QueryParser.Parse(this.textBoxQuery.Text, "text", new
StandardAnalyzer());
problem solved

and now for the big one
4. ????
Is it possible to combine queries in order to create something that looks
like this:

{text:hello subject:greetings}

???

Am I on the wrong path and have to do something else?

Can anyone PLEASE help me, I am really frustrated...

Thank you