Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to give url pattern to search for values like "L76255 - Manual Call Point" . values which contains whitespaces ? #194

Open
rishi1804 opened this issue Jan 31, 2020 · 3 comments

Comments

@rishi1804
Copy link

rishi1804 commented Jan 31, 2020

I am making API in django and for that, I need to give a path in URL pattern to match values like
L76255 - Manual Call Point
please help @arxenix @ponsfrilus @loisaidasam

@loisaidasam
Copy link
Contributor

Hi @rishi1804 , can you provide more detail?

So the pattern can be letters, numbers, dashes, and spaces? Any specific order?

Maybe something like:

[\w\-\s]+

(Some amount of alphanumeric characters/hyphens/spaces)

🤷‍♀️

@rishi1804
Copy link
Author

@loisaidasam yes the pattern can consist of letters, numbers, dashes, and spaces, for example, I need to match values like L76255 - Manual Call Point while making URL patterns in Django

@rishi1804
Copy link
Author

def get_asset_deatils_by_class(request,slug):
connections.create_connection(hosts=['localhost'], timeout=20)
client = Elasticsearch()
s = Search(using=client, index='assets').query("match",class__raw=slug)
response = s.execute()
list1 = response.to_dict()
return JsonResponse(list1)

this is the code and here the slug argument is going to be of the form L76255 - Manual Call Point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants