How to make Faceted Search Views work.

Junro - February 10, 2009 - 15:46
Project:Faceted Search
Version:6.x-1.x-dev
Component:Views integration
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hello, It was a long time that I was waiting Views integration with Faceted Search, thanks!

But I never used faceted serach before and I've got some question about views integration:

1) Views integration uses arguments? So users should enter exactly the argument in order to make the view page result work?

2) The base path (/admin/settings/faceted_search) must be the same than the page path? (what I do)
Is my view settings are enough? see the screenshot

3) Right now, when I use the keywork block, the result page is the defaut page, not the view page, but when I click on "more option" I have the view page. Normal?

Thanks :)

AttachmentSize
screenshot_search_results.JPG35.69 KB

#1

Junro - February 10, 2009 - 15:48
Title:HOW TO: Faceted Search Views » How to make Faceted Search Views work.

#2

David Lesieur - February 10, 2009 - 15:58

1) Have you read the documentation? There is a section about Views integration.

2) Faceted Search Views will embed your view's default display. The page display and its path are irrelevant.

3) Uncheck the Use the Extracts display style selectively option in your faceted search environment.

#3

Junro - February 10, 2009 - 16:06

sure I had read he documentation ^^

ok, Use the Extracts display style selectively option was check.

Now I have this:

warning: preg_match() expects parameter 2 to be string, array given in /home/pariscin/www/includes/bootstrap.inc on line 737.
recoverable fatal error: Object of class faceted_search could not be converted to string in /home/pariscin/www/sites/all/modules/views/includes/view.inc on line 682.

#4

Junro - February 10, 2009 - 16:24

I updated the Views 6.x-2.3, and I still got this:

warning: preg_match() expects parameter 2 to be string, array given in /home/pariscin/www/includes/bootstrap.inc on line 737.
recoverable fatal error: Object of class faceted_search could not be converted to string in /home/pariscin/www/sites/all/modules/views/includes/view.inc on line 688.

#5

David Lesieur - February 10, 2009 - 17:35

Try removing the argument from your view. It probably interferes with Faceted Search Views' own argument manipulation (which will probably need to be made more robust!).

Try also applying the patch in #371398: Bug in module causes exception. if you have not applied it yet (but I guess you have already).

#6

Junro - February 10, 2009 - 18:06

If I remove the argument from the view, I don't have the warning error, but the search doesn't work: no results.

Your search yielded no results
Check if your spelling is correct.
Remove quotes around phrases to match each word individually: "blue smurf" will match less than blue smurf.
Consider loosening your query with OR: blue smurf will match less than blue OR smurf.

The search works great with the core search module.

ps: I'm using the patch "faceted_search_views_arg.patch"

#7

matt2000 - March 5, 2009 - 03:47

I'm having the same or a similar issue. My views display:

recoverable fatal error: Object of class faceted_search could not be converted to string in /home/web/sites/all/modules/views/includes/view.inc on line 1024.

and my integer CCK facets yield no results, even those the count shows that there are nodes.

#8

matt2000 - March 5, 2009 - 04:27

Ok, my second symptom is definitely specific to CCK facets, so not relevant to this queue. I'm not sure baout the first symptom yet, though. It is the same error as Junro. Any insight?

#9

Junro - March 7, 2009 - 01:42

I've still got this problem... I don't know how to resolve that... :(

#10

David Lesieur - March 9, 2009 - 21:49

@Junro: Still got the problem with version 6.x-1.0-beta2?

#11

Junro - March 9, 2009 - 21:52

Yes, exactly the same problem, no changes.

#12

Junro - March 9, 2009 - 22:18

oh just have some news...

I disable Autocomplete Node Finder module and I have this:

warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /home/pariscin/www/includes/database.mysql.inc on line 321.
warning: preg_match() expects parameter 2 to be string, array given in /home/pariscin/www/includes/bootstrap.inc on line 737.

--->/home/pariscin/www/includes/bootstrap.inc on line 737.
same message that:

warning: preg_match() expects parameter 2 to be string, array given in /home/pariscin/www/includes/bootstrap.inc on line 737.
recoverable fatal error: Object of class faceted_search could not be converted to string in /home/pariscin/www/sites/all/modules/views/includes/view.inc on line 682.

Maybe it would help...

#13

akhil - March 13, 2009 - 10:51

I am trying to use views for displaying the results as described in documentation. After selecting the view for display style, I get no results for all keywords.

Your search yielded no results
Check if your spelling is correct.
Remove quotes around phrases to match each word individually: "blue smurf" will match less than blue smurf.
Consider loosening your query with OR: blue smurf will match less than blue OR smurf.

It works fine with Teasers and Extracts. I echoed the $search variable in format_results function of faceted_search_views.module and it has 1 result but views_embed_view doesn't return any result. I have a simple node-view with pager on. Am I doing some mistake in configuring the view?

#14

akhil - March 13, 2009 - 11:10

Putting these two lines (taken from teaser style class) before returning in format_results function of faceted_search_views.module

$limit = $this->get_limit();
$found_items = $search->load_results($limit);

seems to show the results correctly. I don't know if this is correct (using faceted search for the first time), but might help.

#15

ccshannon - May 12, 2009 - 02:33

Having same problem. View is setup according to documentation, unchecked Extract, now I get "no results" message.

Going to try some other Views settings.

#16

ccshannon - May 12, 2009 - 02:46

I did the following, and then I got results.

Not only should you not expose filters, you should just remove them entirely. Also remove any sorting. Also set a limit per page, even though the docs say you can use Unlimited (it will use the Drupal results per page settings) I put in a limit (the same one as the system, why not).

Now I get the view display. So, I think some Views tweaking will do the trick.

#17

David Lesieur - May 12, 2009 - 16:16
Version:6.x-1.0-beta1» 6.x-1.x-dev

@ccshannon: I have reproduced one of the issues you have mentioned: When a view had an unlimited number of items per page, we got empty results instead of the documented behavior of using the system's default number of nodes per page. I have just committed a fix for this bug.

However, using non-exposed filters and sort handlers should work fine. Views integration would not be so useful without those.

#18

ccshannon - May 13, 2009 - 19:03

Thank you for investigating the issue, David. I did the "change three things at once" method, got results, and hadn't yet spent the time to figure out exactly which one it was. Much obliged. Cheers!

#19

macrodesign - June 26, 2009 - 21:23

dear ccshannon,

your 3 step is so logical and workable, but i failed. i tried the following additional steps although, created a new search environment, created a new view tried other combination etc but No results when I use a view in results. my only problem is that I want to hide the statistics on the search page i.e. "Medium - admin - 06/24/2009 - 00:24 - 0 comments - 0 attachments" that's it. If there is another simpler way of doing it, please advise so I don't bother my self (4rth time so far) trying to combine views with faceted search (beautiful monster).

#20

ccshannon - July 2, 2009 - 02:26

@macrodesign

Hey! Sorry I was off Drupal.org for a few days. Just saw this but have to shut down for tonight.

I am going to look at this tomorrow, just want to keep the ball in play, so to speak. Talk to you, soon! -C

#21

macrodesign - July 2, 2009 - 17:14

thanks ccshannon,
i will be looking forward to hearing from you.

best wishes
Danish

#22

bmoreinis - July 7, 2009 - 19:55

Note typo on line 1114 of view.inc - "apger" instead of "pager".
Although fixing that did NOT solve my "Object of class faceted_search could not be converted to string" error....

-Bram

#23

ccshannon - July 11, 2009 - 06:09

Sorry about the delay, macrodesign. Got busy, have bad back from sitting wrong, etc. Haven't been myself lately.

In any case ... if you just want to theme your existing search results, and if you feel comfortable with a little PHP, you can copy the file modules/search/search-result.tpl.php, into your site theme folder. The $info variable contains the stats you want to make invisible. If you want to keep some of those stats, you can get to them via the $info_split variable. The documentation is in the head of the template file.

As far as faceted search, make sure you have a node view, that it has no arguments and no exposed filters, that it has a pager, and that the items per page is set to a number other than 0. Go back into faceted search settings and try selecting the view again. Save your settings.

The site I'm working on ended up taking the template approach. Originally the client wanted to break up the results in the display by content type, but they finally realized they wanted all the content in the same search results on the page, so I did not get to go further with working with faceted search, at least on this project.

Best of luck!

#24

macrodesign - July 11, 2009 - 08:21

thanks ccshannon, i will try this and let you know.

#25

-Shaman- - October 29, 2009 - 13:51

I made faceted search views results based on default frontpage view (just got rid of "featured on the front page", and "sticky" filters), but when I click on vocabulary and navigate to some page (I'm using ajax pager and that was the cause of using the views at the first place) in results I'm getting all nodes from all vocabularies instead of just the chosen one.

 
 

Drupal is a registered trademark of Dries Buytaert.