Currently I don't see range field with other fields at: /admin/config/search/search_api/index/ENTITY_TYPE/fields
It should be integrated with Search API, so could be searchable using search engines (e.g. apachesolr).
See:
http://drupalcode.org/project/search_api.git/blame/refs/heads/7.x-1.x:/R...
#1093332: Custom field type
Information for developers
--------------------------| NOTE:
| For modules providing new entities: In order for your entities to become
| searchable with the Search API, your module will need to implement
| hook_entity_property_info() in addition to the normal hook_entity_info().
| hook_entity_property_info() is documented in the entity module.
| For making certain non-entities searchable, see "Item type" below.
| For custom field types to be available for indexing, provide a
| "property_type" key in hook_field_info(), and optionally a callback at the
| "property_callbacks" key.
| Both processes are explained in [1].
|
| [1] http://drupal.org/node/1021466
| Comment | File | Size | Author |
|---|---|---|---|
| #46 | range-add_add_support_for_search_api-1872194-45.patch | 23.86 KB | taran2l |
| #33 | interdiff.txt | 17.29 KB | taran2l |
| #33 | range-add_add_support_for_search_api-1872194-33.patch | 24.19 KB | taran2l |
Comments
Comment #1
taran2lHi kenorb,
You cited information how to add support for properties of custom entities in order to be searchable via Search API, not fields.
I've checked Search API docs and didn't find what I need to add to the code.
Maybe you have another suggestions ?
Thanks!
Comment #2
ghindle commentedFrom the Search API Readme:
Comment #3
kenorb commentedhook_entity_property_info_alter()
Comment #4
taran2lComment #5
taran2lAdded support for the hook_entity_property_info().
Search API DB has an issue with dealing with multiple decimal fields. Here's an issue and patch: #1916474: Search DB incorrectly index multiple float/decimal fields
Comment #7
polI'm also looking for this feature. Any update ?
Comment #8
taran2lThis feature is already there. What are you looking for exactly ?
Comment #9
polHey hi Roman,
What a quick reply, thanks !
I was looking for that yesterday and I ended up doing my own module in a sandbox, here: https://drupal.org/sandbox/pol/2128471
It's very simple and expose the "Range" fields to Search API.
Now the trick is this... let's take an example to explain what I would like to achieve:
I don't know yet how to do, but I will try to give it a couple of hours these days.
Comment #10
gilsbert commentedHi Taran2L.
Hi Pol.
I need to use range fields in search_api too.
I could find my field in the option "Add related fields".
But after including the field the list is not updated with it and the field is not available for indexing.
In this moment I could find fields "from" and "to" in the option "Add related fields". After adding both fields they are not available for indexing as well.
I tested this using search_api 7.x-1.9 and last dev version.
In both the same result: I can't see the field/fields for indexing.
My database is a postgresql database.
What am I doing wrong?
Regards,
Gilsberty
P.S.: Pol, I need a facet doing filtering over a range field, much like your example. Is your sandbox working?
Comment #11
gilsbert commentedA final note: I'm using search_api_db as the service for indexing.
Comment #12
gilsbert commentedHi.
I read the file range.module and I couldn't find any trace of the patch at #3 (I could not find any function integrating range with search_api).
I applied the patch and tried to index my range field. No success (nothing changed).
No idea what else I might try.
I'm going to wait for help now.
Regards,
Gilsberty
Comment #13
polHi there,
My sandbox does what I need for now, it's clear that adding a facet with a slider would be a huge plus but I don't have the time to work on this, I would help someone to do it for sure though.
Comment #14
gilsbert commentedHi Pol.
I tried your sandbox without success. It appears that search_api is understanding much better the type "range" (the field is not listed in the option "Add related fields" and it is showed in the list available for indexing).
After marking my range field for indexing and renewing my index I get an ajax error in the indexing process.
I'm using the last dev version of search_api and search_api_db.
By the way, are you using search_api_db as your index server?
To be honest now I'm a litle lost.
Taran2L: should "range" module integrates naturally with search_api or should we use Pol's sandbox?
Regards,
Gilsberty
Comment #15
taran2lHi guys,
Seems like Search API changed property type int to integer after the original integration has been added.
Should work fine now.
Small explanation how to use: as this field has multiple values (FROM and TO) it should be added from the Additional fields selectbox. Basically, it works like Body field.
Please confirm that the issue is being solved.
P.S. Please create a separate issue for newly found bugs.
Comment #16
taran2lComment #17
gilsbert commentedHi Taran2L.
Thank you very much. The last git version has this issue fixed and the fields "from" and "to" can be indexed now.
Please clarify to me one thing: the fields "from" and "to" are added as independents fields. Do you think it is possible to add them as a true range/interval of values and make a search_api facet work like what Pol explained on his example?
Finally, do you think that this should be done in range module or in a new one?
Regards,
Gilsberty
Comment #18
taran2lSearch API on it's own does only simple equal queries. In this case you can search by FROM and TO value. In range/out of the range queries is not possible.
There an issue #1903342: Integration with Search API ranges. It could be it. I need to check this approach.
Meanwhile, you can achieve such functionality with Views. Look for Content: FIELD_NAME range filter.
Comment #19
gilsbert commentedHi Taran2L.
Thank you for the information. Now I'm following the issue #1903342. :-)
The exposed filter "Content: FIELD_NAME range filter" is working perfectly in a view based on content data type (i.e.: nodes).
But I can't choose the filter in my view based on a search_api index! There are not "content" fields but only "indexed" fields avaliable on filter.
I tried to force a relationship with the node... no success.
I have this same limitation with https://drupal.org/project/views_between_dates_filter (it is a filter that works for date start/end range!).
Do you have an idea why I can't use the "range" filter on a view based in a search_api index?
Regards,
Gilsberty
Comment #20
kenorb commentedComment #22
gilsbert commentedHunnnnnn.... no answer to my question at #19.
Comment #23
tymn commentedWe're also wanting to add an exposed range filter to a view based on Search API Indexed content.
Our use-case is for a holiday rentals site:
Has anyone found a solution for this using Search API views?
Comment #24
taran2lHi @tymn,
Range module provides a views filter called @label range filter that should work for your use case. It allows for filtering a view by searching that something is within the range or outside it.
However, it's not possible to do it with search index views.
Comment #25
taran2lComment #30
taran2lUpdated tests, so they pass with Drupal core 7.50
Comment #31
taran2lMake sure that we attach views handlers to fields that are being indexed.
Comment #32
taran2lOoops, missed dpm()
Comment #33
taran2lNew patch:
Comment #40
taran2ld.o doesn't not pick up new test dependecies until the patch is committed, let's do it again
Comment #46
taran2lOk, reroll
Comment #48
taran2l