stacker.news/docs/testing-search.md
Noah 02278c6073
Improved ux for domain only searches (#782)
* improves ux for url only searches

* updates with sn nym

* add back original implementation when query has more than url: filter

* eliminates use of wildcards

* adds docs for testing search in a way that more closely resembles prod

* fixes lint issues

---------

Co-authored-by: utanapishtim <utnapishtim.utanapishtim@gmail.com>
2024-02-07 18:45:11 -06:00

1001 B

Testing Search

You may want to create an index that more closely resembles prod for testing search. The simplest way is to create an index that applies an english analyzer on title and text fields.

Create a new index in OpenSearch

curl 
  \ -H "Content-Type: application/json" 
  \ -X PUT 
  \ -d '{"mappings":{"properties":{"text":{"type":"text","analyzer":"english","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"title":{"type":"text","analyzer":"english","fields":{"keyword":{"type":"keyword","ignore_above":256}}}}}}' 
  \ "http://localhost:9200/english" 
  \ -ku admin:admin

Reindex your documents into the english index

curl 
  \ -H "Content-Type: application/json" 
  \ -X POST 
  \ -d '{"source":{"index":"item"},"dest":{"index":"english"}}' 
  \ "http://localhost:9200/_reindex?wait_for_completion=false" 
  \ -ku admin:admin

Update .env.sample

Search for OPENSEARCH_INDEX=item and replace it with OPENSEARCH_INDEX=english