Searching across all fields in all types

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Searching across all fields in all types

Clinton Gormley
Hiya

Let's say I have 3 types:

 - user:
     - id
     - name
     - email
 - blog_post:
     - id
     - title
     - text
 - comment:
     - id
     - title
     - text
     - blog_post_id

Searching for keywords is easy - I can search across types
'blog_post,comment' and fields: ["text","title"]

But I want an admin search that will search across all types, matching
against any field in any type, (eg the admin searches for an ID, or an
email address)

Is there a way to specify: "search across all fields for all object
types", or do I have to specify the fields to search? What if I specify
'email' as one of the fields, but 'blog_post' doesn't have an 'email'
field?

Or should I add another common field to all objects eg "keywords" which
would contain all the keywords for all the other fields?

thanks

Clint

--
Web Announcements Limited is a company registered in England and Wales,
with company number 05608868, with registered address at 10 Arvon Road,
London, N5 1PR.

Reply | Threaded
Open this post in threaded view
|

Re: Searching across all fields in all types

kimchy
Administrator
Hi,

   You can certainly add fields (even ones that only exists on certain types) as fields in the queryString for example to search across all types. You will need, today, to add those fields yourself and do the search, no worries if some only exists in certain types.

   I do plan to try and address this very common scenario. For example, in Compass (my other search project) there is a concept of an "all" field, that simply held all the fields content (thus increasing, though not by much thanks to the inverted index model) the index, but having the ability to search on the all field and thus basically searching on everything. The problem is that in Lucene 3.0 its a bit difficult to do what I did in Compass (it still uses Lucene 2.4). I do plan to see how this can be added though one way or (hack)nother.

-shay.banon

On Tue, Mar 9, 2010 at 3:30 PM, Clinton Gormley <[hidden email]> wrote:
Hiya

Let's say I have 3 types:

 - user:
    - id
    - name
    - email
 - blog_post:
    - id
    - title
    - text
 - comment:
    - id
    - title
    - text
    - blog_post_id

Searching for keywords is easy - I can search across types
'blog_post,comment' and fields: ["text","title"]

But I want an admin search that will search across all types, matching
against any field in any type, (eg the admin searches for an ID, or an
email address)

Is there a way to specify: "search across all fields for all object
types", or do I have to specify the fields to search? What if I specify
'email' as one of the fields, but 'blog_post' doesn't have an 'email'
field?

Or should I add another common field to all objects eg "keywords" which
would contain all the keywords for all the other fields?

thanks

Clint

--
Web Announcements Limited is a company registered in England and Wales,
with company number 05608868, with registered address at 10 Arvon Road,
London, N5 1PR.