@Named(value="mlController") @ConversationScoped public class MLController extends Object implements Serializable
The method search provides a suggest list searching a phrase within the document content of the current workitem.
| Modifier and Type | Field and Description |
|---|---|
protected MLService |
mlService |
static List<String> |
STOP_PHRASE_LIST |
protected org.imixs.workflow.faces.data.WorkflowController |
workflowController |
| Constructor and Description |
|---|
MLController() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
endsWithSpecialCharacter(String s)
This helper method tests if a given string ends with a special character like
'&', '
|
static List<String> |
findMatches(String phrase,
String _text)
Returns a matching text sequences form a search phrase
e.g.
|
static List<String> |
findMatchesOld(String phrase,
String _text)
Deprecated.
|
String |
getMLResult()
Returns a JSON object containing the current ml result status and the item
names collected by the MLAdatper.
|
List<String> |
getSearchResult() |
static int |
indexOfStopPhrase(String searchText,
int fromIndex)
This method finds the earliest stop phrase in a given string.
|
boolean |
isMLItem(String name)
This method returns true if the item value for a given item was computed by
the MLAdatper
|
void |
reset()
This method reset the search and input state.
|
void |
search()
This method searches a text phrase within the document content of attached
documents.
|
@Inject protected org.imixs.workflow.faces.data.WorkflowController workflowController
@Inject protected MLService mlService
public boolean isMLItem(String name)
name - public String getMLResult()
{"status":"suggest",
"items": [
"_invoicenumber",
"_invoicetotal"
]
}
The following stati are defined:
public void search()
JSF Integration:
<h:commandScript name="imixsOfficeWorkflow.mlSearch" action=
"#{mlController.search()}" rendered="#{mlController!=null}" render=
"ml-results" />
JavaScript Example:
imixsOfficeWorkflow.mlSearch({ item: '_invoicenumber' })
public static List<String> findMatches(String phrase, String _text)
e.g. 'cat' is found in 'Catalog'
The method also searches for computed phrases based on the first hit with spaces. The method combines words separated by spaces.
A so called stop-character-phrase indicates the end for a computed phrase. For example more than one space, \n, '. ' or ', '
data - public static boolean endsWithSpecialCharacter(String s)
s - public static int indexOfStopPhrase(String searchText, int fromIndex)
Stop phrases are more than one space, '. ', ', ', '\n'
@Deprecated public static List<String> findMatchesOld(String phrase, String _text)
e.g. 'cat' is found in 'Catalog'
The method also searches for computed phrases based on the first hit.
It seems that this kind of problem can not be solved with regex.
data - public void reset()
Copyright © 2020–2021 Imixs Software Solutions GmbH. All rights reserved.