1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Search Handler

Discussion in 'XenForo Development Discussions' started by ragtek, Mar 29, 2011.

  1. ragtek

    ragtek Guest

    I have a content type with 3 textfields (title, text1, text2)

    How can i insert both texts into the search (and also use them for search)?
    PHP:
    public function insertIntoIndex($contentType$contentId$title$message$itemDate$userId$discussionId 0, array $metadata = array())
    Should i store text2 into the metadata field? I haven't seen anywhere a example, how to use this exactly.
     
  2. Jaxel

    Jaxel Well-Known Member

    I was wondering the same thing... I considered the metadata field, but looking at those fields for other contenttypes, it seems to be for shorthand information like node IDs, thread IDs, etc...
     
  3. ragtek

    ragtek Guest

    ok it seems that i got it working:)
    metadata are useless, but it's possible to add own costraints & joinfields to the data handler.
     
  4. Jaxel

    Jaxel Well-Known Member

    Share to explain? :eek:
     
  5. Kier

    Kier XenForo Developer Staff Member

    Concatenate text1 and text2 and insert them into the message field.
     
  6. Kier

    Kier XenForo Developer Staff Member

    I'm rather curious to hear an explanation for that assertion myself :cautious:
     
  7. ragtek

    ragtek Guest

    No, they are not useless, i couldn't use them for this "problem"^^

    that's also a nice way(and much easier as mine)
    But at least i know now how the search is working, so it was not for nothing^^
     
  8. xfrocks

    xfrocks Well-Known Member

    Hey ragtek,

    I think you should put them all in the message field instead of doing expensive join operation. You will also have the benefit of being FULL TEXT searched (and it will still work if someone came up with a different search engine later)
     
  9. Kier

    Kier XenForo Developer Staff Member

    Joins should be avoided wherever possible, as they prevent non-SQL search engines being employed, hence breaking the plugin system.
     

Share This Page