I am using the `TypesenseInstantSearchAdapter`, an...
# community-help
s
I am using the
TypesenseInstantSearchAdapter
, and it has been a while since I set this up I notice my code:
Copy code
function renderSearch(searchType) {
			if (search) {
				search.dispose();
			}

			let queryBy;

			if (searchType === 'semantic') {
				queryBy = 'embedding';
			} else if (searchType === 'keyword') {
				queryBy = 'Field1,Field2,Field3,Field4';
			} else {
				queryBy = 'Field1,Field2,Field3,Field4,embedding';
			}

			const typesenseInstantsearchAdapter =
				new TypesenseInstantSearchAdapter({
					server: TYPESENSE_SERVER_CONFIG,
					additionalSearchParameters: {
						query_by: queryBy,
						exclude_fields:
							'embedding,Field1,Field2,Field3,Field4',
						prefix: false,
					},
				});

			const searchClient = typesenseInstantsearchAdapter.searchClient;
...
...
I am not sure anymore why I did
exclude_fields
at all. Miracoulously the search works, but when I read this code, I am confused why it does 🤣 As I understand it I effectively tell it to search by fields I then explicitly exclude later 🤔
k
Emebedding field has no use for display and fetching that will be a bit slow since a lot of network transfer will happen. So you are right in searching on it but excluding it from the response.
s
Got that, this is not the exclude from query, it excludes from response, as what I can access later in the
hit
?
k
Yes
🙏 1