You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Saroja Kanta Maharana <sa...@gmail.com> on 2007/02/01 12:44:26 UTC

Please Help me on Lucene

Hi All,

I am new to LUCENE,I have an query that, I have to index a Product table,
Suppose that table has following Columns.

             product [ prod_Id as primary key, prod_name, prod_price]

I have an requirement like if someone searches for prod_id or prod_price, I
have to fetch the rows( prod_id, prod_name, prod_price individualy row-wise)
matches the search condition from the indexed files.

I am n't understanding how to index the table,

 { Like i have create one Document object  and fields Object as columns
value }
Or
 { More than one document object and search through the Documents }

How to search Please help me in this regards.



Regards
Saroja kanta Maharana

Re: Please Help me on Lucene

Posted by Chris Hostetter <ho...@fucit.org>.
Please, do not ever, under any circumstances at all, cross post a
message to all of these lists -- there is absolutely no reason for it, and
doing so will most likely only make people mad and uncooporative.

if you are trying to use Java Lucene, then post your message to java-user
list.  if you are trying to use solr, then post your message to the
solr-user list, etc....  If you know you want to do something with Lucene,
but you aren't sure which list ot mail to, email general@lucene and ask
what the appropriate list is for your question.


-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Please Help me on Lucene

Posted by Christoph Pächter <Pa...@htwg-konstanz.de>.
I am also only novice, but that should work for you.

One row in your table ==> one doc in lucene:

I would indice it like that for one row/document:

Document doc = new Document();

doc.add(new Field("prod_Id....
doc.add(new Field("prod_name...
...
writer.addDocument(doc);



Now check your index using Luke: http://www.getopt.org/luke/
Just start the web version quickly and look at your index. (Luke is simple and
nice to use, mostly self-explanatory)
You can search for your value and look at the docs. So use it to check your 
query...


If you search for a value, in your class you get the hits-object.

Hits hits = searcher.search(query);

Document doc = hits.doc(i);//gives you the document (rank i), which is one row.

doc.get("prod_Id"); to retrieve the fieldvalues

Cheers,
Christoph

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org