I have tried php library with json sample data(10k...
# community-help
a
I have tried php library with json sample data(10k), it takes more time to show search results... Do we need to get data from json on every search ??
k
👋 Do you mean that the search takes time or the import?
a
Create collection from jsonl file takes more time
k
Are you running Typesense locally or on a server? How long does it take to import the 10K documents?
a
Running locally using postman... takes 1 min.. attached image FYI
message has been deleted
Hello
k
@Arumugam P I'm afraid I don't follow you still. Can you add some logging to your code to see which exact call takes a long time? The code snippet above contains both document creation and search operations.
Also, instead of looping and indexing each document, use Import: https://typesense.org/docs/0.22.1/api/documents.html#index-multiple-documents
a
Tried with import, now search result showing with in 600ms
message has been deleted
k
What's is the time taken value in the json response?
a
Sorry for my question.. I have downloaded PHP library and access like this http://localhost/typesense-php-master/examples/collection_operations.php?query=Harry with the help of docker
In the documentation end point showing like
GET ${TYPESENSE_HOST}/collections/:collection/documents/search
message has been deleted
k
In the response Typesense will return the time it took internally for the search. Can you post that?
a
[found] => 1     [hits] => Array         (             [0] => Array                 (                     [document] => Array                         (                             [authors] => Array                                 (                                     [0] => J.K. Rowling                                     [1] =>  Mary GrandPré                                 )                             [authors_facet] => Array                                 (                                     [0] => J.K. Rowling                                     [1] =>  Mary GrandPré                                 )                             [average_rating] => 4.44                             [id] => 2                             [image_url] => 

https://images.gr-assets.com/books/1474154022m/3.jpg

                            [publication_year] => 1997                             [publication_year_facet] => 1997                             [ratings_count] => 4602479                             [title] => Harrywww Potter and the Philosopher's Stone                         )                     [highlights] => Array                         (                             [0] => Array                                 (                                     [field] => title                                     [matched_tokens] => Array                                         (                                             [0] => Harrywww                                         )                                     [snippet] => <mark>Harrywww</mark> Potter and the Philosopher's Stone                                 )                         )                     [text_match] => 33514496                 )         )     [out_of] => 9979     [page] => 1     [request_params] => Array         (             [collection_name] => books             [per_page] => 10             [q] => Harrywww         )     [search_cutoff] =>      [search_time_ms] => 0 )
k
Search time ms is 0 as per Typesense.
a
I want to integrate with my php application
k
I'm sorry, but I still don't understand what problem you are facing here.
a
As per my understanding, need to keep required information in jsonl file right
k
I think it is best if you can post the full code snippet as a Github gist, and describe what problem you are facing fully.
a
I'm not facing problem, now search result showing quickly
k
👍
a
I want to integrate search function in my PHP application, just asking your guidance
k
You will integrate just as you integrate with any other data store or database.
a
Do you have any reference to use mysql database instead of jsonl
k
We don't integrate directly with the database. You have to either write to Typesense at the same time you write to the DB in the application. Or dump data from your DB periodically, convert to JSONL and index them into Typesense
a
Okay, Thank you so much
Sorry for my small questions
k
No worries 👍