/recommend works
This commit is contained in:
parent
3e8d5115f3
commit
713443a74e
@ -72,7 +72,7 @@ const sendRequest = async()=>{
|
||||
// page_num: pageNumber.value,
|
||||
// page_size: pageSize.value
|
||||
};
|
||||
console.log("searchStore: ", searchStore.searchParams)
|
||||
//console.log("searchStore: ", searchStore.searchParams)
|
||||
router.push("/table");
|
||||
}
|
||||
</script>
|
||||
@ -57,15 +57,14 @@ const goToSearchPage=()=>{
|
||||
}
|
||||
|
||||
onMounted(()=>{
|
||||
console.log("macdonals query: ", query)
|
||||
console.log("macdonals query: ", query.search_type)
|
||||
|
||||
let requestType="POST";
|
||||
if (query.search_type==="semantic"){
|
||||
requestType = "GET"
|
||||
}
|
||||
fetchData("/search",requestType,query).then(response =>{
|
||||
|
||||
console.log("responseData start dolphine: ", response)
|
||||
|
||||
if (response.data.length===0){
|
||||
|
||||
|
||||
@ -74,27 +73,40 @@ onMounted(()=>{
|
||||
}
|
||||
else {
|
||||
responseData.value = response
|
||||
keys_of_a_data.value = Object.keys(response.data[0])
|
||||
|
||||
|
||||
keys_of_a_data.value.forEach((item, index)=>{
|
||||
|
||||
arr_col_items.value.push(...Object.keys(response.data[0][item]))
|
||||
})
|
||||
|
||||
|
||||
response.data.map(item=>{
|
||||
const values:any[]=[]
|
||||
|
||||
Object.keys(item).forEach(key=>{
|
||||
if(requestType==="POST"){
|
||||
keys_of_a_data.value = Object.keys(response.data[0])
|
||||
|
||||
|
||||
keys_of_a_data.value.forEach((item, index)=>{
|
||||
|
||||
arr_col_items.value.push(...Object.keys(response.data[0][item]))
|
||||
})
|
||||
|
||||
values.push(...Object.values(item[key]))
|
||||
|
||||
})
|
||||
|
||||
row_values.value.push(values)
|
||||
|
||||
}) }
|
||||
response.data.map(item=>{
|
||||
const values:any[]=[]
|
||||
|
||||
Object.keys(item).forEach(key=>{
|
||||
// key here is metadata and search
|
||||
|
||||
values.push(...Object.values(item[key]))
|
||||
|
||||
})
|
||||
|
||||
row_values.value.push(values)
|
||||
})
|
||||
}
|
||||
|
||||
else if(requestType === "GET"){
|
||||
|
||||
arr_col_items.value =Object.keys(responseData.value.data[0])
|
||||
|
||||
row_values.value = responseData.value.data.map(item=> Object.values(item))
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}).catch(error=>{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
export const fetchData = async(endpoints="", requestType="GET", requestBody:Record<string,any>|null =null)=>{
|
||||
console.log("superman,requestType, requestBody stars: ", requestType,requestBody)
|
||||
|
||||
try{
|
||||
const options:RequestInit={
|
||||
method:requestType,
|
||||
@ -11,7 +11,7 @@ export const fetchData = async(endpoints="", requestType="GET", requestBody:Reco
|
||||
}
|
||||
|
||||
if (requestType !=="GET" && requestBody){
|
||||
console.log("before JSON.stringify")
|
||||
|
||||
options.body = JSON.stringify(requestBody)
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user