Skip to content
New issue

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

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

Already on GitHub? # to your account

Using wildcard for the first search word does not work #6

Closed
xena68 opened this issue May 10, 2014 · 10 comments
Closed

Using wildcard for the first search word does not work #6

xena68 opened this issue May 10, 2014 · 10 comments

Comments

@xena68
Copy link

xena68 commented May 10, 2014

I tried to use wildcards[0] to reflect "open" or "close" with this keyword statement, however, it does not work. I suspect the problem is using "*" as the first search phrase.

self.keywords.append({'find': [['*', 'the', 'garage']], 'call': 'garage'})

@xena68
Copy link
Author

xena68 commented May 10, 2014

[Update -- something is still not working correctly even after the fix below.]

I found the error. Same error was causing this to fail:

self.keywords.append({'find': [['turn', '*', 'the', 'outside', 'lights']], 'call': 'outsidelights'})

The fix is in search.py. wildcard_end was being set to 0 instead of -1 in this clause:

if (wildcard_end > -1):
wildcards_found[wildcard_counter] = q[wildcard_start:wildcard_end]
wildcard_start = 0
wildcard_end = -1

@RobinMeis
Copy link
Owner

Thank you for the report. I will look for this and try to fix it. Did you try to use a phrase instead of just a single word? Instead of ['turn', '', 'the', 'outside', 'lights']: ['turn', '', 'the outside lights']?

@RobinMeis RobinMeis added this to the 1.0.3 milestone May 10, 2014
@RobinMeis RobinMeis self-assigned this May 10, 2014
@xena68
Copy link
Author

xena68 commented May 10, 2014

No, I didn't realize that would work. I will try it.

On Sat, May 10, 2014 at 3:15 PM, HcDevel notifications@github.com wrote:

Thank you for the report. I will look for this and try to fix it. Did you
try to use a phrase instead of just a single word? Instead of ['turn', '',
'the', 'outside', 'lights']: ['turn', '
', 'the outside lights']?

Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-42753051
.

@RobinMeis
Copy link
Owner

I tried self.keywords.append({'find': [['*', 'the', 'garage']], 'call': 'garage'}) and as you described, it didn't work. But with a phrase it works: self.keywords.append({'find': [['*', 'the garage']], 'call': 'garage'}). Your second example has to look like this: self.keywords.append({'find': [['turn', '*', 'the outside lights']], 'call': 'outsidelights'}).

In the next version I will redesign the code and make it better documented. Maybe I will also improve the wildcard handling.

@RobinMeis RobinMeis removed this from the 1.0.3 milestone May 10, 2014
@xena68
Copy link
Author

xena68 commented May 11, 2014

Made the changes you suggested and yes, they work now! Thanks you.

Encountered a new problem. The following is not found even though the words and case all come through correctly:

self.keywords.append({'find': [['turn', '', 'the volume', '', 'the', '', 'room'], ['turn', '', 'the volume', '', 'the', '']], 'call': 'volumeupdown'})

@RobinMeis
Copy link
Owner

I can't test it right now but I think you just forgot the stars to declare the wildcards.

@xena68
Copy link
Author

xena68 commented May 13, 2014

That did paste strange in the post, but the asterisks are there in the code.

RobinMeis added a commit that referenced this issue May 13, 2014
The q.find didn't continue behind the last position so words were found
to times if they were the same, seperated with a wildcard.

Also removed a debug print
@RobinMeis
Copy link
Owner

I found your problem and solved it. I added a solution in the issue #6 branch which you can find here: https://github.com/HcDevel/Siri-API/tree/Issue-%236. To download it with git you can run this command: git clone https://github.com/HcDevel/Siri-API.git -b Issue-#6.

Please let me know if this worked for you.

@xena68
Copy link
Author

xena68 commented May 17, 2014

Yes, that worked. Thanks.

@RobinMeis RobinMeis mentioned this issue May 17, 2014
RobinMeis pushed a commit that referenced this issue May 17, 2014
@RobinMeis RobinMeis added this to the 1.0.3 milestone May 17, 2014
@RobinMeis
Copy link
Owner

Thank you for the testing. I just merged the code to the master repository. I didn't change anything else so you don't have to update again.

RobinMeis added a commit that referenced this issue Jun 29, 2014
The fix for issue #6 wasn't already added in this branch
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants