Hi everyone. Looking into replacing Elasticsearch ...
# community-help
m
Hi everyone. Looking into replacing Elasticsearch with Typesense for some parts of our software and am currently trying to figure out (actually at the end of my own ideas) how to reflect a filesystem so that a search can be limited/filtered to a certain directory/path and its children (recursive). Is that a possible use-case?
d
I think the easiest way is to store all path combinations (e.g.
/
,
/path
,
/path/to
) in a field and then use it in array filter_by: https://typesense.org/docs/0.24.1/api/search.html#filter-parameters
https://gist.github.com/b0g3r/64d7998b25f8a4b04f94737adc81df70 something like this. You can run docker typesense to test it out
I found that Typesense (at least my version of it) ignores first
/
, however it shows the proof of concept
k
You can configure Typesense to index special characters by using the
symbols_to_index
configuration during collection creation.
Copy code
curl -k "<http://localhost:8108/collections>" -X POST -H "Content-Type: application/json" \                                                                                                                        
      -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '{
        "name": "docs",
        "fields": [        
          {"name": "title", "type": "string" },
          {"name": "points", "type": "int32" }
        ], "symbols_to_index": ["/"]
      }'
m
Thanks guys. The array approach seems like a good fit for this.