I want to add dropdown that comes from custom table in typo3 solr facets - solr

I have indexed page correctly and solr is working, but I want to insert facets.
I have write below typoscript for adding contain of table tx_srcdataprovider_domain_model_tag, it added in index queue but not indexed properly.
How do I show all tag fields in dropdown in facets?
Please give me some example to add facets in typo3 solr.
Thanks in advance
tx_srcdataprovider_domain_model_tag = 1
tx_srcdataprovider_domain_model_tag {
table = tx_srcdataprovider_domain_model_tag
fields {
tag = tag
// the special SOLR_CONTENT content object cleans HTML and RTE fields
content = SOLR_CONTENT
content {
field = description
}
// the special SOLR_RELATION content object resolves relations
category_stringM = SOLR_RELATION
category_stringM {
localField = category
multiValue = 1
}
// build the URL through typolink, make sure to use returnLast = url
url = TEXT
url {
typolink.parameter = 1
typolink.additionalParams = &tx_srcdataprovider_domain_model_tag[item]={field:uid}
typolink.additionalParams.insertData = 1
typolink.returnLast = url
typolink.useCacheHash = 1
}
// the special SOLR_MULTIVALUE content object allows to index multivalue fields
keywords = SOLR_MULTIVALUE
keywords {
field = keywords
}
tag_stringS = tag
}

Related

Select urls from Typo3 Database via Typoscript query

First my goal: I want to create a list with links to internal pages. This list has to be ordered by creation date (crdate in the DB)
To achieve this, I wrote the following code:
99 = CONTENT
99.table = pages
99.select {
pidInList = root,-1
selectFields = url
orderBy = crdate
}
Sadly, this returns nothing.
For debugging I played with the different properties.
With
99 = CONTENT
99.table = tt_content
99.select {
pidInList = 1
orderBy = crdate
}
I cloned my rootpage. I got all records from it.
So I know that all page records should be stored in the Pages table with the url.
What am I doing wrong here?
Additional information: Typo3 8.7, no the default backend elements are not working for me, yes I have to do it in typoscript
Thanks in advance for any suggestions.
The field url in the pages record does not hold the url from that page in general.
It is used only for pages of type external URL, so the internal link to this page can be forwarded to that url.
If you want a link list of all your pages you need to create a link to these pages:
99 = CONTENT
99 {
table = pages
select {
// your selection here
}
renderObj = TEXT
renderObj {
typolink {
parameter.field = uid
}
}
}
This will give you a list (if wrapping the renderObj with <li>|</li>) of complete links with page title as link text.
If you want only urls you can add:
typolink {
returnLast = url
}
Without wrapping it will be a long string without separation.
EDIT:
99 = CONTENT
99 {
table = pages
select {
pidInList = 69
orderBy = crdate desc
}
wrap = <ul>|</ul>
renderObj = TEXT
renderObj {
wrap = <li>|</li>
typolink {
parameter.field = uid
}
if.isFalse.cObject = CONTENT
if.isFalse.cObject {
table = pages
select {
// this 'uid' is from context of current pages record we have selected above
pidInList.field = uid
// this 'uid' is the field from the records we are selecting here
selectFields = uid
}
renderObj = TEXT
// this 'uid' is the selected field above
// a field in the pages record of the subquery to decide if there are child pages
renderObj.field = uid
# renderObj.wrap = |,
}
}
}

How to delete highlight annotation from pdf with pdf js express in react

I am using pdf js express to draw highlight annotation in pdf. But when I couldn't delete the annotation from the pdf. I am using this code to create highlight:
const { Annotations, annotManager } = instance;
citations.forEach((citation) => {
if (citation.quads && isNumber(citation.page) && !isNaN(parseInt(citation.id))) {
const citationAuthor = citation.created_by && citation.created_by.user
? `${citation.created_by.user.first_name} ${citation.created_by.user.last_name}`.trim()
: author;
const highlight = new Annotations.TextHighlightAnnotation();
highlight.Author = citationAuthor;
highlight.Quads = citation.quads;
highlight.PageNumber = citation.page;
highlight.Id = citation.id.toString();
highlight.Locked = true;
highlight.Subject = 'Citation';
annotManager.addAnnotation(highlight, true);
annotManager.drawAnnotations(highlight.PageNumber);
}
});
I am not finding any way to delete highlight annotation which will basically remove the highlight from the pdf
You will have to get Annotations object first and then delete highlight annotation by using deleteAnnotation API . Try following :
highlight = annotManager.getAnnotationById( yourCitationId);
annotManager.deleteAnnotation(highlight)

How to get the token value from meta tag in a outlet page - Drupal 7?

I need to display the meta tag values from the meta tag tokens.
My Code:
function MyModule_html_head_alter(&$head_elements) {
$head_elements['metatag_description']['#value'] = $outlet_description;
}
Actual Output:
[node:node_sections] - [node:field_lead_text] Testing
Expecting Output:
Food - Testing lead text Testing
You have to use token_replace function
$menu = menu_get_item();
if($menu['path'] == 'node/%') { // check if you are on node page
$node = $menu['page arguments'][0];
$head_elements['metatag_description']['#value'] = token_replace($outlet_description, array('node' => $node));
}

How can I add/remove rows in ag-Grid?

I've using ag-Grid with my React - Typescript project I can set data and get selected data from table but I don't know how to add new empty field and how to remove selected field, I've find on its documents but does not found :(
Using setRowData to set rows so when I want to add new empty field I have to do like
const allNodesData = Array<any>()
this.gridApi.forEachNode((node) => {
allNodesData.push(node.data)
})
allNodesData.push({})
this.gridApi.setRowData(allNodesData)
And when I want to remove selected field I have to do like
const selectedNodes = this.gridApi.getSelectedNodes()
const allNodesData = Array<any>()
this.gridApi.forEachNode((node) => {
if (selectedNodes.indexOf(node) < 0)
allNodesData.push(node.data)
})
this.gridApi.setRowData(allNodesData)

How to set default id as 0 for new tags

How to set a default id to 0 for the tags which is not from the list ?
[DEMO LINK][1]
LINK
In the above e.g if we select from existing, then it comes with id (1 or 2 or 3), but if add new Tag and press enter then the id becomes as text, i want id to set as o for new tag OR not from the list.
How to do that?
CreateSearchChoice should be what you are looking for
here is a similar SO i asked a while ago select2 createSearchChoice id from post
createSearchChoice: function (term, data) {
if ($(data).filter(function () {
return this.text.localeCompare(term) === 0;
}).length === 0) {
// if not found in current list
// return {id:term, text:term}
return {
id: term,
text: $.trim(term) + ' (new tag)'
};
},
Note i am setting the id to new text term, you could set it to a concatenated value like -1/term, then parse it out later, but term must be included in the ID for this solution
then on the change event, i determine whether the id is numeric (exists already). if its not numeric (added in the createsearchchoice) I go through my process of posting to the database of tags
.on("change", function(e) {
if (e.added) { //is it added from select2
if (isNumeric(e.added.id)){ //did it already exist or createsearchchoice
add(e.added.id); //it already existed, just add it to the tag list
} else { //id was created on the fly, post to the database and return a tag id
$.post('handlers/tags.ashx', {
operation:"select2createtag",
//because its not numeric, we know id = new tag text
text: $.trim(e.added.id)} ,
function(data){
//set the added id to the id you just returned from sql
e.added.id = data.id;
//...do something else, like then add the new tag to the item
});
};
};
if you dont want to post to ajax, have your server-side evaluate your input items, and any tags that are non-numeric for id , follow the same idea above
I updated your Plunker here

Resources