Closed (fixed)
Project:
Apache Solr Search
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
6 Mar 2009 at 21:03 UTC
Updated:
30 Apr 2009 at 15:50 UTC
Jump to comment: Most recent file
Comments
Comment #1
pwolanin commentedSure, however we need to index that information, otherwise there is nothing to facet.
Comment #2
jody lynnI should have this working shortly.
Comment #3
jody lynnThis is working- it indexes book bid's and has a facet for the book a book node belongs to and a block to filter by book.
Comment #4
pwolanin commentedOne initial suggestion - you might want to index a bid of 0 for nodes not in any book (see the OG integration) in order to facet/filter-out those nodes not in any book.
Comment #5
pwolanin commentedAn alternative is here: http://www.nabble.com/How-to-know-if-a-field-is-null--td19114164.html
something like: &fq=-is_book_bid:[* TO *]
but I think there is still an outstanding issue to make the query class support negative queries.
Comment #6
jody lynnComment #7
jody lynnHmm, my comment disappeared.
I just added 0 for non-books in the index and display them as 'No Book' (that part was actually in my previous patch already due to following og integration logic)
Comment #8
jody lynnAlso I just made a module which provides a search/book-search/BID menu callback to display solr search results within a particular book. It also adds a search bar to book nodes for search within that book. It relies on apachesolr_book. Is that better off as a separate contrib module?
It was more of a pain to do something like that than I expected - I followed the logic in project_solr.module. I wonder if some of the logic in apachesolr_search_search could be made into more of an API to create custom search pages free from the default search callback in an easier way.
Comment #9
pwolanin commentedYes - we certainly intend to make refinements to the API to make this easier, there are a couple open issues.
Comment #10
pwolanin commentedHmm, yes - just made an interesting observation: we can get a facet count for all those docs missing the field by adding to the params:
This is better in many ways than indexing a 0, since it requires re-indexing only nodes in books, not all nodes.
This same technique should go in the OG module - the only trick is figureing out how to make a proper facet link.
Comment #11
pwolanin commenteddoing this get results back like:
So you can look for the key "_empty_" as we do already for language.
Comment #12
pwolanin commentedsee: http://drupal.org/node/348029#comment-1458656
Comment #13
pwolanin commentedGiven that book module is in core and the code here is pretty minimal, we should probably just make this part of the main module - especially if we can get the negative queries working right.
Also, did you just copy this over and modify from the OG module?
I think I added that kind of code there since we were considering adding links to the groups to each search result. Based on the code here, there's no read to add the bid to search results.
Comment #14
pwolanin commentedhey, just realized that you're the fabulous Jody that AlexUA kept mentioning at our meetup!
Anyhow - I need to sort the minor APi changes for the Views integration people, then we can toss in the negative query support and this faceting will be like 10 lines in the main module (like it supports taxonomy now).
Comment #15
pwolanin commentedok, this is basically working (includes some other misc improvements).
taxonomy doesn't properly handle missing facets, and I'm not sure about language.
Comment #16
pwolanin commentedstray !
Comment #17
pwolanin commentedplus breadcrumb theme function and better handling for $node->language.
Comment #18
damien tournoud commentedTwo remarks:
should probably be $facet_missing
and
create the book facet unconditionnally, even if the book module is not enabled.
Comment #19
pwolanin commentedI think it's fine to set the facet_missing unconditionally, since it will have not effect absent the facet being used.
Patch with fixes for the other problems.
I'd like to find a way to use em tags or something for the missing facet - it's very non-obvious otherwise.
Comment #20
pwolanin commenteddoxygen fix
Comment #21
jody lynnThanks Peter. I'll test it on our site shortly
Comment #22
pwolanin commentedFurther improved - updated apachesolr_l() to handle $options['html']
Comment #23
pwolanin commenteddocument apachesolr_l() a little.
Comment #24
pwolanin commentedcommitted to 6.x
Comment #25
jody lynnA bit late to the review, but the latest dev is working fine for us for book facet. We're planning to release a contrib module that adds a search bar to book pages which does search within that book.