Results 1 to 5 of 5
  1. #1
    gertnaster is offline Member
    Join Date
    Jul 2013
    Posts
    3
    Rep Power
    0

    Default one search with more than one term in many fields

    hey guys, sorry for my bad english. i don't ask for stuff in english forums a lot but i can not find a german one for this.

    i have an index. the data in the index has 8 fields (agent, eventname, ip-adress etc)

    i have a search engine with only one text field. here the user should be able to search for different terms.. when he looks up for "Mozilla" i start the function getEvent(String agent) which only looks in the field FIELD_AGENT.
    But he should also be able to search for more terms. like "Mozilla EventClick 127.0.0.1". Then the function is like getEvent(String agent, String ename, String ip).
    But what when the user searches in a different order, like "127.0.0.1 EventClick Mozilla". Then the function wouldnt be right cause the String agent would get the ip and so on. How can i handle that? Or should i just analyze the search string in terms and look for EVERY term in EVERY field?

    hope you understand what i am trying to explain :D i am super thankful for every help!!

    greetings, gertnaster

  2. #2
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,152
    Rep Power
    6

    Default Re: one search with more than one term in many fields

    The way I handle that is to simply index all the values as part of ONE field by appending them all into one large String (separated by spaces). Then it doesn't matter what the user types in, Lucene will find the entry.

  3. #3
    gertnaster is offline Member
    Join Date
    Jul 2013
    Posts
    3
    Rep Power
    0

    Default Re: one search with more than one term in many fields

    Thank you for helping!! How should I do that? Sorry i am really not good in programming :/

  4. #4
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,152
    Rep Power
    6

    Default Re: one search with more than one term in many fields

    In other words: you're running before you learned how to walk - don't you think it is a good idea to take a step back and actually learn how to walk first, which in this case is to learn basic Java programming?

    But how you do your business is exactly that: your business. Investigate the StringBuilder class, looking for examples on how to use it will probably help you a lot.

  5. #5
    gertnaster is offline Member
    Join Date
    Jul 2013
    Posts
    3
    Rep Power
    0

    Default Re: one search with more than one term in many fields

    I have to create a tool for my studys. It's a project i got from a guy here but i don't really have a lot of time to build it. He gave me an index, so i just included it and try to work with that. But i don't know how to add all the fields to one. But thank you a lot for the tip!!

Similar Threads

  1. Using Lucene to get term-document matrix
    By TextAsData in forum Lucene
    Replies: 0
    Last Post: 08-16-2012, 04:39 AM
  2. Getting the term object from a string.
    By koolmelee in forum Lucene
    Replies: 1
    Last Post: 09-17-2011, 07:59 PM
  3. Number of searched term in Documents
    By MrUni in forum Lucene
    Replies: 0
    Last Post: 12-14-2010, 04:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •