I сan not organize a search query by "hash" with variables

type Product  {
	id: ID! 
	name: String! @search(by:[hash]) 
	quantity: Int! 
	availability: Boolean! 
	price: Float! 
	image_src: String! 
	category: [Category] 
	brand: Brand 
	specification: [About] 
	description_shot: String 
	description_long: String 

I think it should be like this, but I’m not sure:

query MyQuery($filter: ProductFilter) {
	queryProduct(filter: $filter) {

{"variables": {"filter": { "name": { "eq": "note" } }}}

are you wanting to ‘order’? Is that what you mean by organize? So others can better assist can you give an example of the results you are getting and the results you are expecting instead. Of if you are getting an error, provide the error you are seeing.

Commenting from your other post, if this is your specific problem, you need to input the variables you want to return like so:

query MyQuery($filter: ProductFilter) {
	queryProduct(filter: $filter) {

Otherwise, as @amaster507 said, we need more information on your exact problem with error messages, expected results, etc…


Applying a hash search index, the GraphQL API generates the eq and in filters


So you don’t

write a search query using “hash”

but instead you write a search query using either eq or in

1 Like

I need to search for one word from the title.
For example:
Cloud Core 7.1
So that you can get id when requesting only “Core”

Thank you very much for the answers, I don’t know what I want))

{"filter": { "name": { "regexp": "/.*Core.*/" } }}

name: String! @search(by:[regexp])

query MyQuery($filter: ProductFilter) {
	queryProduct(filter: $filter) {

A regexp search is the most expensive. If that is what you need, then so be it, but for your case, a term index will get you what you want.

It might seem odd for anyofterms (any of terms) or allofterms (all of terms) to be just a single term, but either function will work for that.

And to get term based indexes using @search(by: [term])

P.S. You can also apply multiple indexes to have what you need available when you need it like: @search(by: [exact,regexp,term,fulltext]) You just can’t use both hash and exact together. exact will generate a few more options such as lt (less than), le (less than or equal to), ge (greater than or equal to), gt (greater than), and between but if those are not needed then a hash index may work better especially if you are working with longer strings.

P.P.S Your regex can be simplified to just use "/Core/". The additional .* are not doing anything in this case at the beginning and end of a regular expression.

Thanks for the answer, I understood where to “dig”))
This is my first React Apollo DGraph application.