Keyword search within everything

Grantovich - July 7, 2008 - 14:42
Project:Faceted Search
Version:5.x-1.0-beta4
Component:Field Search
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I'm probably overlooking or misunderstanding something, but I can't figure out how to get a faceted search environment to just search "everything": Title, taxonomy, and any CCK fields I have indexed. If I use the default "Anywhere" search, I only get keyword matching against node titles and taxonomy (node bodies are disabled in my content type). If I activate the "in [some field]" option, I only get keyword matching against that particular field, not any other fields, and titles/taxonomy are not searched. Ideally I would be able to search within all indexed fields, and titles/taxonomy, thus not exposing the "where to search" dropdown to users. Is this possible?

#1

David Lesieur - July 8, 2008 - 16:38

Unless there is a bug, the Anywhere search should do what you expect, searching the node bodies, titles, CCK fields, and taxonomy — in other words, searching the core index.

#2

Grantovich - July 8, 2008 - 18:34

Maybe there is a bug then, because as far as I can tell, Faceted Search isn't searching my fields. I do have the CCK Field Indexer module turned on, and I've told it to index the fields I want. I've rebuilt the index several times, and made sure it was 100% complete. I've even looked in the database and confirmed that the words from those fields do appear in the search_index table. But when I search for one of those very same words, I just get a "no results" page. Searching for words that are in the node titles and taxonomy works fine; I can even search for words that appear in comments, and it will bring up the relevant node. It's just the CCK fields that aren't getting searched.

#3

David Lesieur - July 8, 2008 - 20:32

Could it be that your fields are hidden from full node views? (in the fields' display settings, admin/content/types/mynodetype/display)

Hidden fields will cause the behavior you have described since their content won't show up in the full node index. However, Field Indexer still gives those fields their field-specific index entry because it doesn't check for field visibility.

#4

Grantovich - July 8, 2008 - 21:12

Just checked, they're all set to Default in both Full and Teaser modes. I usually leave those settings alone, since I'm overriding everything with contemplates and panels anyway. Speaking of which, could that cause any problems? I hope not.

#5

David Lesieur - July 8, 2008 - 21:28

I'm not sure whether Contemplate can interfere with indexing, but I'd be very surprised is Panels did. Can you test this with Contemplate disabled?

#6

Grantovich - July 8, 2008 - 22:14

Disabled all my clever contemplates, reindexed, and... now it works fine. Go figure.

Of course, without those templates, my site layout is toast. The whole reason I wasn't displaying most of the CCK fields in the node body was because I pulled them into a "custom content" chunk in my Panels layout that resides elsewhere on the page. Would this issue be considered a flaw in the search mechanism? in Panels? in Contemplate? in anything?

#7

David Lesieur - July 9, 2008 - 01:01

To me, this is not a flaw in Contemplate or Panels because the problem is more fundamental, in the node rendering mechanism. Nodes are always rendered in one of two modes: teaser or full. We need this to be expandable (e.g. indexing mode, RSS mode, print-friendly mode, JSON mode). This is a big issue being discussed for Drupal 7... Not much we can do for now, except helping with that issue.

In the meantime, I guess only a custom module could ensure that what you want to be indexed gets indexed regardless of your content templates.

#8

Grantovich - July 9, 2008 - 02:59

To me it doesn't appear that the indexing is the problem; after all, even with the templates enabled, the fields have indeed been indexed, as I confirmed by looking at the search_index table. It seems more a question of the method used to do keyword searches. Is there no way to simply search both the node body and any indexed CCK fields as well?

#9

David Lesieur - July 9, 2008 - 18:58

The keywords for sure appear in search_index, because Field Indexer adds them. If you double-check, you'll probably find that those keywords are only indexed with type = 'field_NN' (these are Field Indexer's entries). However, for the core search or Faceted Search's Anywhere search to find those keywords, they need to be indexed with type = 'node' (these are the core search entries, which won't be present when the keywords only occur in fields that are hidden from node views).

#10

Grantovich - July 10, 2008 - 14:21

I guess what I'm asking for, then, is a way to do what I want with what's available right now, given that I don't have the luxury of waiting until Drupal 7 is released. This search module seems to be the only one that even gives me the option of searching CCK fields, so it's still the closest thing I have to a solution.

You mentioned the possibility of developing a custom module. Due to my circumstances, and the fact that I am not a competent PHP coder (much less a module developer), this would be an absolute last resort. I would be interested in hearing about any alternative search solutions that may exist, or any modifications that might be made to existing components to get the functionality I need.

One major limitation I'm working under is that the site will be on an isolated network, so anything that requires access to the internet (e.g. Google site search) is definitely not possible.

 
 

Drupal is a registered trademark of Dries Buytaert.