I thought a sphinx search only matched whole works by default. In searching for various acronyms I seem to match beginnings as well. For instance 'prov' will match 'provide' not 'improve'. I only want it in fact to match " prov ". Is there some setting I need to change to make it 'Word' only?
Index Settings:
wordforms = /home/indexer/wordform.txt
stopwords = /home/indexer/stopwords.txt
stopword_step = 0
morphology = stem_en
index_sp=1
html_strip = 1
min_word_len = 1
min_infix_len = 1
Follow-up: I min_infix_len = 0 (and rotated index) to no avail.
Related
I have a sphinx index set up with a field that has the following data:
James Smith
When I search for 'James' or 'James Smi', it will return the proper result, but when I search for 'James S' it doesn't return anything.
I also have a real time index (RT) and it has the same data in it and I'm able to search for 'James S' and it returns the proper result.
Here is what I have in my config file for the main index
min_word_len = 1
html_strip = 0
min_infix_len = 2
expand_keywords = 1
min_prefix_len = 1
index_exact_words = 1
Min_infix_len=2 means part word matches are only going to work for two letter queries or longer. The j does not match in part of word, only a standalone word. Because of min_word_len
I have a structure myS with several fields, including myField, which in turns includes several other fields such as BB. I need to count how many time *'R_value' appears in BB.
I have tried:
sum(myS.myField.BB = 'R_value')
and this:
count = 0;
for i = 1:numel(myS.myField)
number_of_element = numel(myS.myField(i).BB)=='R_value'
count = count+number_of_element;
end
but it doesn't work. Any suggestion?
If you are just checking if BB is that literal string, then your loop is just:
count = 0;
for i = 1:numel(myS.myField)
count = count+strcmp(myS.myField(i).BB,'R_value')
end
numel counts how many elements are. Zero is an element. so is False. Just sum the array.
count = 0;
for i = 1:numel(myS.myField)
number_of_element = sum(myS.myField(i).BB==R_value)
count = count+number_of_element;
end
Also note you had the parenthesis wrong, so you where counting how many BB where in total, then comparing that number to R_value. I am assuming R_value is a number.
e.g.:
myS.myField(1).BB=[1 2 3 4 1 1 1]
myS.myField(2).BB=[4 5 65 1]
R_value=1
I have a cell array of which the last part looks like this:
Columns 8372 through 8375
{'w20091231_2000.nc'} {'w20091231_2020.nc'} {'w20091231_2040.nc'} {'w20091231_2100.nc'}
Columns 8376 through 8379
{'w20091231_2120.nc'} {'w20091231_2140.nc'} {'w20091231_2200.nc'} {'w20091231_2220.nc'}
Columns 8380 through 8383
{'w20091231_2240.nc'} {'w20091231_2300.nc'} {'w20091231_2320.nc'} {'w20091231_2340.nc'}
Columns 8384 through 8387
{'wD1.nc'} {'wD2.nc'} {'wD3.nc'} {'wD4.nc'}
Now I want to rearrange this array so that it only contains the last four strings.{'wD1.nc'} {'wD2.nc'} {'wD3.nc'} {'wD4.nc'}
I tried
IndexC = strfind(names,'wD*.nc');
Index = find(not(cellfun('isempty',IndexC)))
and
Index = find(contains(names,'wD*.nc'));
names2=names(Index)
both work if wD*.nc is wD4.nc but then of course I only select the one value and not the four that I want.
How do I get to use the * ?
I had to do some googling but found this https://www.mathworks.com/matlabcentral/answers/77039-comparing-strings-with-wildcards , and something like the following seems to work:
IndexC = regexp(names, regexptranslate('wildcard', 'wD*.nc'));
Index = find(not(cellfun('isempty',IndexC)));
names2=names(Index)
In one line using regexp with the match option:
x = regexp([x{:}],'wD\d+\.nc','match')
I often have the requirement to send a powermail-form to different receivers depending on a selection of a selectfield within the form.
Im using TYPO3 7.6.x and Powermail 3.3.0
How can this be done?
With the help of #alex-kellner in the slackchannel of EXT:powermail i found a quite easy solution for that:
Basically there are 2 Steps needed:
Step1
Values for the Options in the select field.
You need to add values to your option in the select field. This can be done by appending a pipe | to your option and simply add the value
MyRecieverEmail 1 | 1
MyRecieverEmail 2 | 2
MyRecieverEmail 3 | 3
In addition to that, you need to know the marker / variable / individual fieldname of your field. You can find that name in the extended tab of your field.
You can also give this field an "own" variable name if needed. The variable is wrapped with {} but you will not these in step 2
Step 2
Now you need to add some TS in your setupfield.
Background information: Basically this changes the reciever for a form:
plugin.tx_powermail.settings.setup.receiver.overwrite.email = TEXT
plugin.tx_powermail.settings.setup.receiver.overwrite.email.value = your#email.com
Now you need to check wich option was choosen in the form. This is done by a global condition:
[globalString = GP:tx_powermail_pi1|field|yourVariableFieldname = 1]
Where yourVariableFieldname ist the individual fieldname from the extended tab in the field and 1 is the value of the first option (MyRecieverEmail 1)
By using this TS, the form will be send to your#email.com if the first option MyRecieverEmail 1 is choosen in the form:
[globalString = GP:tx_powermail_pi1|field|yourVariableFieldname = 1]
plugin.tx_powermail.settings.setup.receiver.overwrite.email = TEXT
plugin.tx_powermail.settings.setup.receiver.overwrite.email.value = your#email.com
[global]
You can now add as much conditions as you need. The complete example would be:
[globalString = GP:tx_powermail_pi1|field|yourVariableFieldname = 1]
plugin.tx_powermail.settings.setup.receiver.overwrite.email = TEXT
plugin.tx_powermail.settings.setup.receiver.overwrite.email.value = yourfirst#email.com
[global]
[globalString = GP:tx_powermail_pi1|field|yourVariableFieldname = 2]
plugin.tx_powermail.settings.setup.receiver.overwrite.email = TEXT
plugin.tx_powermail.settings.setup.receiver.overwrite.email.value = yoursecond#email.com
[global]
[globalString = GP:tx_powermail_pi1|field|yourVariableFieldname = 3]
plugin.tx_powermail.settings.setup.receiver.overwrite.email = TEXT
plugin.tx_powermail.settings.setup.receiver.overwrite.email.value = yourthird#email.com
[global]
Please be aware that this will be in charge for every field with the fieldname {yourVariableFieldname} in your TYPO3-Install where this TS is taken into account.
This can be useful if you use this field exactly like this in multiple forms.
If you dont want this to be in charge you have 2 options to avoid this:
only place the TS on the Page where your form is located.
You can add this to your global condition:
&& [globalString = GP:tx_powermail_pi1|mail|form = 123]
Where 123 is the ID of your form.
This would then look like this:
[globalString = GP:tx_powermail_pi1|field|yourVariableFieldname = 2] && [globalString = GP:tx_powermail_pi1|mail|form = 123]
Since 9.5 something like this:
[traverse(request.getParsedBody(), 'tx_powermail_pi1/field/yourVariableFieldname') == 1 ]
should works
This worked for me:
[traverse(request.getParsedBody(), 'tx_powermail_pi1/field/yourVariableFieldname') == 1 ]
plugin.tx_powermail.settings.setup {
receiver.overwrite {
email.value = MYEMAIL
email = TEXT
}
}
[END]
[traverse(request.getParsedBody(), 'tx_powermail_pi1/field/yourVariableFieldname') == 2 ]
plugin.tx_powermail.settings.setup {
receiver.overwrite {
email.value = MYEMAIL2
email = TEXT
}
}
[END]
I need to combine the binary representation of 6 and 7 together:
bin1 = fliplr(de2bi(6));
bin2 = fliplr(de2bi(7));
bin1 =
1 1 0
bin2 =
1 1 1
after the combination the number should be
bin3 = 110111
Does anyone have any idea on how to do this?
As suggested you can just concatenate them
bin3 = [bin1, bin2]
However, if you really want them packed together without spaces you can do it like this:
bin3 = num2str([bin1, bin2]);
bin3 = bin3(bin3 ~= ' ')
If you want to turn them in to a number now you can use str2num()