LIKE filter is missing. Here is the patch

Closing as a duplicate of #3444888: LIKE and EXACT filter for searching fulltext (9.0.x, 8.0.x).

CommentFileSizeAuthor
#10 3092486-10.patch939 byteskevinn
#2 3092486.patch669 bytesabrar_arshad
LIKE-filter.patch708 bytesabrar_arshad

Comments

abrar_arshad created an issue. See original summary.

abrar_arshad’s picture

StatusFileSize
new669 bytes

Here is the revised patch pls

abrar_arshad’s picture

Hello, any updates on this? I wonder if this module's maintenance has been discontinued

sokru’s picture

Version: 8.x-7.0-alpha2 » 8.0.x-dev

Looks good, we could add this. My only concern is that should be check if the value has % character at beginning or at end of the value and convert it to asterisk *? Drupal database abstraction layer uses asterisk, e.g. ->condition('field_title', '%my article%', 'LIKE'). With Elasticsearch wildcard, one that is used in patch, requires asterisk to be used.

abrar_arshad’s picture

I think it is best to leave how it gets used by the API consumer, given already how aggregation is written for ElasticSearch and MySQL syntactically and semantically differently using the same Query API that accepts different parameters.

Edited: The point is not to assume what user may input as parameters and intervene but rather should allow to align with actual ElasticSearch docs and practices.

abrar_arshad’s picture

Hi sokru, just wondering if you got some time to merge the patch. Thanks

sokru’s picture

Status: Needs review » Reviewed & tested by the community

Makes sense, I'll add this to next release.

abrar_arshad’s picture

Thanks

karma86’s picture

Hello there!

I created a ticket a while ago with very similar functionality.
https://www.drupal.org/project/elasticsearch_connector/issues/3268303

I could re-roll the patch and extend it with the EXACT functionality too.

kevinn’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new939 bytes

Here is patch with a "NOT LIKE" filter also.

mparker17’s picture

Status: Needs review » Needs work

In #3270464: Investigate search_api_opensearch as base for elasticsearch_connector, we made a bunch of changes to how filters are built, so this patch no longer applies. But I think the feature would still be useful, if it is still possible to implement. The new filter building code is in \Drupal\elasticsearch_connector\SearchAPI\Query\FilterBuilder::buildFilterTerm() now.

Could I also trouble someone to provide a link to the page in the current ElasticSearch documentation that describes the LIKE filter? That would help us to write tests for the LIKE and NOT LIKE filters.

(I'm looking through the issues in the 8.0.x-dev branch as part of a big review of open issues for #3427243: Plan for 8.0.0-alpha release: thank you for your patience with me!)

mparker17’s picture

Issue summary: View changes
Status: Needs work » Closed (duplicate)
Parent issue: » #3444888: LIKE and EXACT filter for searching fulltext (9.0.x, 8.0.x)

Taking a closer look at #3444888: LIKE and EXACT filter for searching fulltext (9.0.x, 8.0.x), it looks like that issue is requesting the same thing, but uses the new syntax and adds an EXACT filter, so I've pasted the code from this ticket into a comment in that one, and I'd like to close this issue as a duplicate, and I will update the credit for that issue accordingly.

Thanks everyone!